package com.amado.course24;

/**
 * 父亲
 * 
 * @author Administrator
 *
 */
public class ObjectToString {
	private String name;
	private Integer age;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	@Override
	public String toString() {
		return name + "\t" + age;
	}
	public String superToString() {
//		return getClass().getName() + "@" + Integer.toHexString(hashCode());
		return super.toString();
	}
	public ObjectToString(String name, Integer age) {
		super();
		this.name = name;
		this.age = age;
	}

	public static void main(String[] args) {
		ObjectToString one = new ObjectToString("张三",11);
		// 如果直接打印一个对象，会调用它的toString方法
		System.out.println(one);
		System.out.println(one.toString());
		System.out.println(one.superToString());
	}
}
